package edu.hsbremen.teamscore.activities;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import edu.hsbremen.teamscore.R;


public class MultiModeSelect extends ListActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		String[] modes = getResources().getStringArray(R.array.multi_modes_array);
		setListAdapter(new ArrayAdapter<String>(this, R.layout.list_view_template, modes));
		
		ListView lv = getListView();
		lv.setTextFilterEnabled(true);
		
		lv.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view, int position,
					long id) {
					
					Bundle bundle = new Bundle();
					bundle.putString("multi_mode", ((TextView) view).getText().toString());
				
					Intent mIntent = new Intent();
		            mIntent.putExtras(bundle);
		            setResult(RESULT_OK, mIntent);
		            finish();
			}
			
		});
	}
}
